package com.yidu.ruifeng_logistics.service.impl;

import com.yidu.ruifeng_logistics.entity.LogisticsClient;
import com.yidu.ruifeng_logistics.dao.LogisticsClientDao;
import com.yidu.ruifeng_logistics.service.LogisticsClientService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (LogisticsClient)表服务实现类
 *
 * @author 文湘
 * @since 2021-03-11 10:22:05
 */
@Service("logisticsClientService")
public class LogisticsClientServiceImpl implements LogisticsClientService {
    @Resource
    private LogisticsClientDao logisticsClientDao;

    /**
     * 通过ID查询单条数据
     *
     * @param clientId 主键
     * @return 实例对象
     */
    @Override
    public LogisticsClient queryById(Integer clientId) {
        return this.logisticsClientDao.queryById(clientId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsClient> queryAllByLimit(int offset, int limit) {
        return this.logisticsClientDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param logisticsClient 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsClient insert(LogisticsClient logisticsClient) {
        this.logisticsClientDao.insert(logisticsClient);
        return logisticsClient;
    }

    /**
     * 修改数据
     *
     * @param logisticsClient 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsClient update(LogisticsClient logisticsClient) {
        this.logisticsClientDao.update(logisticsClient);
        return this.queryById(logisticsClient.getClientId());
    }

    /**
     * 通过主键删除数据
     *
     * @param clientId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer clientId) {
        return this.logisticsClientDao.deleteById(clientId) > 0;
    }

    @Override
    public List<LogisticsClient> queryAll(LogisticsClient logisticsClient) {
        return this.logisticsClientDao.queryAll(logisticsClient);
    }

    @Override
    public int deleteAllId(String[] id) {
        return logisticsClientDao.deleteAllId(id);
    }

    @Override
    public int checkByTeL(String clientTel) {
        return logisticsClientDao.checkByTeL(clientTel);
    }

    @Override
    public Integer selectIdAndName(Integer clientId, String clientName) {
        return logisticsClientDao.selectIdAndName(clientId,clientName);
    }

    @Override
    public LogisticsClient getSession(String clientTel, String clientPwd) {
        return logisticsClientDao.getSession(clientTel,clientPwd);
    }

}
